<template>
  <div class="app-container">
    <h1>设置wsdl信息</h1>
    <el-form ref="form" label-width="120px" :model="formData">
      <el-form-item label="wsdl地址：">
        <el-input v-model="formData.url" clearable placeholder="wsdl地址" />
      </el-form-item>
      <el-form-item label="请求字符串：">
        <el-input
          v-model="formData.requestXML"
          placeholder="请求字符串"
          rows="12"
          type="textarea"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">提交信息</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  import { getWsdl, setWsdl } from '@/api/system'
  export default {
    data() {
      return {
        formData: {
          url: '',
          requestXML: '',
        },
      }
    },
    created() {
      this.getWsdl()
    },
    methods: {
      onSubmit() {
        this.setWsdl()
      },
      getWsdl() {
        getWsdl().then((res) => {
          this.formData = res.data
        })
      },
      setWsdl() {
        setWsdl(this.formData).then((res) => {
          this.$baseMessage(res.msg, 'success', 'vab-hey-message-success')
        })
      },
    },
  }
</script>

<style lang="scss" scoped>
  .app-container {
    padding: 36px;
    h1 {
      margin-bottom: 48px;
      text-align: center;
    }
  }
</style>
